@echo off
chcp 65001 > nul
echo 开始编译迷你银行系统...

if not exist obj mkdir obj

echo 编译源文件...
g++ -std=c++17 -c -I include src/Account.cpp -o obj/Account.o
g++ -std=c++17 -c -I include src/Admin.cpp -o obj/Admin.o
g++ -std=c++17 -c -I include src/Auditor.cpp -o obj/Auditor.o
g++ -std=c++17 -c -I include src/AuthManager.cpp -o obj/AuthManager.o
g++ -std=c++17 -c -I include src/BankSystem.cpp -o obj/BankSystem.o
g++ -std=c++17 -c -I include src/CheckingAccount.cpp -o obj/CheckingAccount.o
g++ -std=c++17 -c -I include src/Customer.cpp -o obj/Customer.o
g++ -std=c++17 -c -I include src/DataManager.cpp -o obj/DataManager.o
g++ -std=c++17 -c -I include src/Employee.cpp -o obj/Employee.o
g++ -std=c++17 -c -I include src/main.cpp -o obj/main.o
g++ -std=c++17 -c -I include src/main_core.cpp -o obj/main_core.o
g++ -std=c++17 -c -I include src/main_customer.cpp -o obj/main_customer.o
g++ -std=c++17 -c -I include src/main_account.cpp -o obj/main_account.o
g++ -std=c++17 -c -I include src/main_employee.cpp -o obj/main_employee.o
g++ -std=c++17 -c -I include src/main_admin.cpp -o obj/main_admin.o
g++ -std=c++17 -c -I include src/main_auditor.cpp -o obj/main_auditor.o
g++ -std=c++17 -c -I include src/main_utils.cpp -o obj/main_utils.o
g++ -std=c++17 -c -I include src/ReportGenerator.cpp -o obj/ReportGenerator.o
g++ -std=c++17 -c -I include src/SavingsAccount.cpp -o obj/SavingsAccount.o
g++ -std=c++17 -c -I include src/Transaction.cpp -o obj/Transaction.o
g++ -std=c++17 -c -I include src/UIManager.cpp -o obj/UIManager.o
g++ -std=c++17 -c -I include src/User.cpp -o obj/User.o
g++ -std=c++17 -c -I include src/Utils.cpp -o obj/Utils.o

echo 链接可执行文件...
g++ -o bank_system obj/*.o

if %errorlevel% neq 0 (
  echo 编译失败，请检查错误信息
) else (
  echo 编译成功，生成可执行文件 bank_system.exe
  echo 正在运行程序...
  bank_system
) 